// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate lazy_static;
extern crate location;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate rpc;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// A Managed Lustre instance.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Instance {
    /// Identifier. The name of the instance.
    pub name: std::string::String,

    /// Required. Immutable. The filesystem name for this instance. This name is
    /// used by client-side tools, including when mounting the instance. Must be
    /// eight characters or less and can only contain letters and numbers.
    pub filesystem: std::string::String,

    /// Required. The storage capacity of the instance in gibibytes (GiB). Allowed
    /// values are from `18000` to `954000`, in increments of 9000.
    pub capacity_gib: i64,

    /// Required. Immutable. The full name of the VPC network to which the instance
    /// is connected. Must be in the format
    /// `projects/{project_id}/global/networks/{network_name}`.
    pub network: std::string::String,

    /// Output only. The state of the instance.
    pub state: crate::model::instance::State,

    /// Output only. Mount point of the instance in the format
    /// `IP_ADDRESS@tcp:/FILESYSTEM`.
    pub mount_point: std::string::String,

    /// Output only. Timestamp when the instance was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Timestamp when the instance was last updated.
    pub update_time: std::option::Option<wkt::Timestamp>,

    /// Optional. A user-readable description of the instance.
    pub description: std::string::String,

    /// Optional. Labels as key value pairs.
    pub labels: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. The throughput of the instance in MB/s/TiB.
    /// Valid values are 125, 250, 500, 1000.
    pub per_unit_storage_throughput: i64,

    /// Optional. Indicates whether you want to enable support for GKE clients. By
    /// default, GKE clients are not supported. Deprecated. No longer required for
    /// GKE instance creation.
    #[deprecated]
    pub gke_support_enabled: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Instance {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Instance::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [filesystem][crate::model::Instance::filesystem].
    pub fn set_filesystem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filesystem = v.into();
        self
    }

    /// Sets the value of [capacity_gib][crate::model::Instance::capacity_gib].
    pub fn set_capacity_gib<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.capacity_gib = v.into();
        self
    }

    /// Sets the value of [network][crate::model::Instance::network].
    pub fn set_network<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.network = v.into();
        self
    }

    /// Sets the value of [state][crate::model::Instance::state].
    pub fn set_state<T: std::convert::Into<crate::model::instance::State>>(mut self, v: T) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [mount_point][crate::model::Instance::mount_point].
    pub fn set_mount_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.mount_point = v.into();
        self
    }

    /// Sets the value of [create_time][crate::model::Instance::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::Instance::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_time][crate::model::Instance::update_time].
    pub fn set_update_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_time][crate::model::Instance::update_time].
    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.update_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [description][crate::model::Instance::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [labels][crate::model::Instance::labels].
    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [per_unit_storage_throughput][crate::model::Instance::per_unit_storage_throughput].
    pub fn set_per_unit_storage_throughput<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.per_unit_storage_throughput = v.into();
        self
    }

    /// Sets the value of [gke_support_enabled][crate::model::Instance::gke_support_enabled].
    #[deprecated]
    pub fn set_gke_support_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.gke_support_enabled = v.into();
        self
    }
}

impl wkt::message::Message for Instance {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.Instance"
    }
}

/// Defines additional types related to [Instance].
pub mod instance {
    #[allow(unused_imports)]
    use super::*;

    /// The possible states of an instance.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum State {
        /// Not set.
        Unspecified,
        /// The instance is available for use.
        Active,
        /// The instance is being created and is not yet ready for use.
        Creating,
        /// The instance is being deleted.
        Deleting,
        /// The instance is being upgraded.
        Upgrading,
        /// The instance is being repaired.
        Repairing,
        /// The instance is stopped.
        Stopped,
        /// The instance is being updated.
        Updating,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [State::value] or
        /// [State::name].
        UnknownValue(state::UnknownValue),
    }

    #[doc(hidden)]
    pub mod state {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl State {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Active => std::option::Option::Some(1),
                Self::Creating => std::option::Option::Some(2),
                Self::Deleting => std::option::Option::Some(3),
                Self::Upgrading => std::option::Option::Some(4),
                Self::Repairing => std::option::Option::Some(5),
                Self::Stopped => std::option::Option::Some(6),
                Self::Updating => std::option::Option::Some(7),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
                Self::Active => std::option::Option::Some("ACTIVE"),
                Self::Creating => std::option::Option::Some("CREATING"),
                Self::Deleting => std::option::Option::Some("DELETING"),
                Self::Upgrading => std::option::Option::Some("UPGRADING"),
                Self::Repairing => std::option::Option::Some("REPAIRING"),
                Self::Stopped => std::option::Option::Some("STOPPED"),
                Self::Updating => std::option::Option::Some("UPDATING"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for State {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for State {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for State {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Active,
                2 => Self::Creating,
                3 => Self::Deleting,
                4 => Self::Upgrading,
                5 => Self::Repairing,
                6 => Self::Stopped,
                7 => Self::Updating,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for State {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "STATE_UNSPECIFIED" => Self::Unspecified,
                "ACTIVE" => Self::Active,
                "CREATING" => Self::Creating,
                "DELETING" => Self::Deleting,
                "UPGRADING" => Self::Upgrading,
                "REPAIRING" => Self::Repairing,
                "STOPPED" => Self::Stopped,
                "UPDATING" => Self::Updating,
                _ => Self::UnknownValue(state::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for State {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Active => serializer.serialize_i32(1),
                Self::Creating => serializer.serialize_i32(2),
                Self::Deleting => serializer.serialize_i32(3),
                Self::Upgrading => serializer.serialize_i32(4),
                Self::Repairing => serializer.serialize_i32(5),
                Self::Stopped => serializer.serialize_i32(6),
                Self::Updating => serializer.serialize_i32(7),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for State {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
                ".google.cloud.lustre.v1.Instance.State",
            ))
        }
    }
}

/// Message for requesting list of Instances
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesRequest {
    /// Required. The project and location for which to retrieve a list of
    /// instances, in the format `projects/{projectId}/locations/{location}`.
    ///
    /// To retrieve instance information for all locations, use "-" as the value
    /// of `{location}`.
    pub parent: std::string::String,

    /// Optional. Requested page size. Server might return fewer items than
    /// requested. If unspecified, the server will pick an appropriate default.
    pub page_size: i32,

    /// Optional. A token identifying a page of results the server should return.
    pub page_token: std::string::String,

    /// Optional. Filtering results.
    pub filter: std::string::String,

    /// Optional. Desired order of results.
    pub order_by: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListInstancesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListInstancesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListInstancesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListInstancesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [filter][crate::model::ListInstancesRequest::filter].
    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.filter = v.into();
        self
    }

    /// Sets the value of [order_by][crate::model::ListInstancesRequest::order_by].
    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.order_by = v.into();
        self
    }
}

impl wkt::message::Message for ListInstancesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ListInstancesRequest"
    }
}

/// Message for response to listing Instances
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListInstancesResponse {
    /// Response from [ListInstances][google.cloud.lustre.v1.Lustre.ListInstances].
    ///
    /// [google.cloud.lustre.v1.Lustre.ListInstances]: crate::client::Lustre::list_instances
    pub instances: std::vec::Vec<crate::model::Instance>,

    /// A token identifying a page of results the server should return.
    pub next_page_token: std::string::String,

    /// Unordered list. Locations that could not be reached.
    pub unreachable: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListInstancesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [instances][crate::model::ListInstancesResponse::instances].
    pub fn set_instances<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Instance>,
    {
        use std::iter::Iterator;
        self.instances = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListInstancesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }

    /// Sets the value of [unreachable][crate::model::ListInstancesResponse::unreachable].
    pub fn set_unreachable<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.unreachable = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListInstancesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ListInstancesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListInstancesResponse {
    type PageItem = crate::model::Instance;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.instances
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// Message for getting a Instance
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetInstanceRequest {
    /// Required. The instance resource name, in the format
    /// `projects/{projectId}/locations/{location}/instances/{instanceId}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.GetInstanceRequest"
    }
}

/// Message for creating a Instance
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateInstanceRequest {
    /// Required. The instance's project and location, in the format
    /// `projects/{project}/locations/{location}`. Locations map to Google Cloud
    /// zones; for example, `us-west1-b`.
    pub parent: std::string::String,

    /// Required. The name of the Managed Lustre instance.
    ///
    /// * Must contain only lowercase letters, numbers, and hyphens.
    /// * Must start with a letter.
    /// * Must be between 1-63 characters.
    /// * Must end with a number or a letter.
    pub instance_id: std::string::String,

    /// Required. The resource being created
    pub instance: std::option::Option<crate::model::Instance>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateInstanceRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [instance_id][crate::model::CreateInstanceRequest::instance_id].
    pub fn set_instance_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.instance_id = v.into();
        self
    }

    /// Sets the value of [instance][crate::model::CreateInstanceRequest::instance].
    pub fn set_instance<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [instance][crate::model::CreateInstanceRequest::instance].
    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::CreateInstanceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for CreateInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.CreateInstanceRequest"
    }
}

/// Message for updating a Instance
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateInstanceRequest {
    /// Optional. Specifies the fields to be overwritten in the instance resource
    /// by the update.
    ///
    /// The fields specified in the update_mask are relative to the resource, not
    /// the full request. A field will be overwritten if it is in the mask. If no
    /// mask is provided then all fields present in the request are
    /// overwritten.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    /// Required. The resource name of the instance to update, in the format
    /// `projects/{projectId}/locations/{location}/instances/{instanceId}`.
    pub instance: std::option::Option<crate::model::Instance>,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes since the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateInstanceRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }

    /// Sets the value of [instance][crate::model::UpdateInstanceRequest::instance].
    pub fn set_instance<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [instance][crate::model::UpdateInstanceRequest::instance].
    pub fn set_or_clear_instance<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Instance>,
    {
        self.instance = v.map(|x| x.into());
        self
    }

    /// Sets the value of [request_id][crate::model::UpdateInstanceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for UpdateInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.UpdateInstanceRequest"
    }
}

/// Message for deleting a Instance
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteInstanceRequest {
    /// Required. The resource name of the instance to delete, in the format
    /// `projects/{projectId}/locations/{location}/instances/{instanceId}`.
    pub name: std::string::String,

    /// Optional. An optional request ID to identify requests. Specify a unique
    /// request ID so that if you must retry your request, the server will know to
    /// ignore the request if it has already been completed. The server will
    /// guarantee that for at least 60 minutes after the first request.
    ///
    /// For example, consider a situation where you make an initial request and the
    /// request times out. If you make the request again with the same request
    /// ID, the server can check if original operation with the same request ID
    /// was received, and if so, will ignore the second request. This prevents
    /// clients from accidentally creating duplicate commitments.
    ///
    /// The request ID must be a valid UUID with the exception that zero UUID is
    /// not supported (00000000-0000-0000-0000-000000000000).
    pub request_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteInstanceRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteInstanceRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::DeleteInstanceRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }
}

impl wkt::message::Message for DeleteInstanceRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.DeleteInstanceRequest"
    }
}

/// Represents the metadata of a long-running operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have been cancelled successfully
    /// have [Operation.error][] value with a
    /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
    /// `Code.CANCELLED`.
    ///
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl OperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::OperationMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::OperationMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for OperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.OperationMetadata"
    }
}

/// Message for importing data to Lustre.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDataRequest {
    /// Required. The name of the Managed Lustre instance in the format
    /// `projects/{project}/locations/{location}/instances/{instance}`.
    pub name: std::string::String,

    /// Optional. UUID to identify requests.
    pub request_id: std::string::String,

    /// Optional. User-specified service account used to perform the transfer.
    /// If unspecified, the default Managed Lustre service agent will be used.
    pub service_account: std::string::String,

    /// A Cloud Storage URI of a folder to import file data from, in the
    /// form of `gs://<bucket_name>/<path_inside_bucket>/`.
    pub source: std::option::Option<crate::model::import_data_request::Source>,

    /// The destination of the data transfer.
    pub destination: std::option::Option<crate::model::import_data_request::Destination>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportDataRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ImportDataRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::ImportDataRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::ImportDataRequest::service_account].
    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_account = v.into();
        self
    }

    /// Sets the value of [source][crate::model::ImportDataRequest::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::import_data_request::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::ImportDataRequest::source]
    /// if it holds a `GcsPath`, `None` if the field is not set or
    /// holds a different branch.
    pub fn gcs_path(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPath>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::import_data_request::Source::GcsPath(v) => std::option::Option::Some(v),
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::ImportDataRequest::source]
    /// to hold a `GcsPath`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_gcs_path<T: std::convert::Into<std::boxed::Box<crate::model::GcsPath>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source =
            std::option::Option::Some(crate::model::import_data_request::Source::GcsPath(v.into()));
        self
    }

    /// Sets the value of [destination][crate::model::ImportDataRequest::destination].
    ///
    /// Note that all the setters affecting `destination` are mutually
    /// exclusive.
    pub fn set_destination<
        T: std::convert::Into<std::option::Option<crate::model::import_data_request::Destination>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = v.into();
        self
    }

    /// The value of [destination][crate::model::ImportDataRequest::destination]
    /// if it holds a `LustrePath`, `None` if the field is not set or
    /// holds a different branch.
    pub fn lustre_path(&self) -> std::option::Option<&std::boxed::Box<crate::model::LustrePath>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::import_data_request::Destination::LustrePath(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::ImportDataRequest::destination]
    /// to hold a `LustrePath`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_lustre_path<T: std::convert::Into<std::boxed::Box<crate::model::LustrePath>>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::import_data_request::Destination::LustrePath(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ImportDataRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ImportDataRequest"
    }
}

/// Defines additional types related to [ImportDataRequest].
pub mod import_data_request {
    #[allow(unused_imports)]
    use super::*;

    /// A Cloud Storage URI of a folder to import file data from, in the
    /// form of `gs://<bucket_name>/<path_inside_bucket>/`.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// The Cloud Storage source bucket and, optionally, path inside the bucket.
        /// If a path inside the bucket is specified, it must end with a forward
        /// slash (`/`).
        GcsPath(std::boxed::Box<crate::model::GcsPath>),
    }

    /// The destination of the data transfer.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Destination {
        /// Lustre path destination.
        LustrePath(std::boxed::Box<crate::model::LustrePath>),
    }
}

/// Export data from Managed Lustre to a Cloud Storage bucket.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDataRequest {
    /// Required. The name of the Managed Lustre instance in the format
    /// `projects/{project}/locations/{location}/instances/{instance}`.
    pub name: std::string::String,

    /// Optional. UUID to identify requests.
    pub request_id: std::string::String,

    /// Optional. User-specified service account used to perform the transfer.
    /// If unspecified, the Managed Lustre service agent is used.
    pub service_account: std::string::String,

    /// The source of the data transfer.
    pub source: std::option::Option<crate::model::export_data_request::Source>,

    /// The destination of the data transfer.
    pub destination: std::option::Option<crate::model::export_data_request::Destination>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportDataRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ExportDataRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [request_id][crate::model::ExportDataRequest::request_id].
    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.request_id = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::ExportDataRequest::service_account].
    pub fn set_service_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.service_account = v.into();
        self
    }

    /// Sets the value of [source][crate::model::ExportDataRequest::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::export_data_request::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::ExportDataRequest::source]
    /// if it holds a `LustrePath`, `None` if the field is not set or
    /// holds a different branch.
    pub fn lustre_path(&self) -> std::option::Option<&std::boxed::Box<crate::model::LustrePath>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::export_data_request::Source::LustrePath(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::ExportDataRequest::source]
    /// to hold a `LustrePath`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_lustre_path<T: std::convert::Into<std::boxed::Box<crate::model::LustrePath>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::export_data_request::Source::LustrePath(v.into()),
        );
        self
    }

    /// Sets the value of [destination][crate::model::ExportDataRequest::destination].
    ///
    /// Note that all the setters affecting `destination` are mutually
    /// exclusive.
    pub fn set_destination<
        T: std::convert::Into<std::option::Option<crate::model::export_data_request::Destination>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = v.into();
        self
    }

    /// The value of [destination][crate::model::ExportDataRequest::destination]
    /// if it holds a `GcsPath`, `None` if the field is not set or
    /// holds a different branch.
    pub fn gcs_path(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPath>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::export_data_request::Destination::GcsPath(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::ExportDataRequest::destination]
    /// to hold a `GcsPath`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_gcs_path<T: std::convert::Into<std::boxed::Box<crate::model::GcsPath>>>(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::export_data_request::Destination::GcsPath(v.into()),
        );
        self
    }
}

impl wkt::message::Message for ExportDataRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ExportDataRequest"
    }
}

/// Defines additional types related to [ExportDataRequest].
pub mod export_data_request {
    #[allow(unused_imports)]
    use super::*;

    /// The source of the data transfer.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// The root directory path to the Managed Lustre file system. Must start
        /// with `/`. Default is `/`.
        LustrePath(std::boxed::Box<crate::model::LustrePath>),
    }

    /// The destination of the data transfer.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Destination {
        /// The URI to a Cloud Storage bucket, or a path within a bucket, using
        /// the format `gs://<bucket_name>/<optional_path_inside_bucket>/`. If a
        /// path inside the bucket is specified, it must end with a forward slash
        /// (`/`).
        GcsPath(std::boxed::Box<crate::model::GcsPath>),
    }
}

/// Response message for ExportData.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDataResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportDataResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for ExportDataResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ExportDataResponse"
    }
}

/// Response message for ImportData.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDataResponse {
    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportDataResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }
}

impl wkt::message::Message for ImportDataResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ImportDataResponse"
    }
}

/// Metadata of the export data operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDataMetadata {
    /// Data transfer operation metadata.
    pub operation_metadata: std::option::Option<crate::model::TransferOperationMetadata>,

    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub verb: std::string::String,

    /// Output only. Human-readable status of the operation, if any.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have
    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ExportDataMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [operation_metadata][crate::model::ExportDataMetadata::operation_metadata].
    pub fn set_operation_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferOperationMetadata>,
    {
        self.operation_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [operation_metadata][crate::model::ExportDataMetadata::operation_metadata].
    pub fn set_or_clear_operation_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferOperationMetadata>,
    {
        self.operation_metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::ExportDataMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ExportDataMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::ExportDataMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::ExportDataMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::ExportDataMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [verb][crate::model::ExportDataMetadata::verb].
    pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.verb = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::ExportDataMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::ExportDataMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::ExportDataMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for ExportDataMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ExportDataMetadata"
    }
}

/// Metadata of the import data operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDataMetadata {
    /// Data transfer operation metadata.
    pub operation_metadata: std::option::Option<crate::model::TransferOperationMetadata>,

    /// Output only. The time the operation was created.
    pub create_time: std::option::Option<wkt::Timestamp>,

    /// Output only. The time the operation finished running.
    pub end_time: std::option::Option<wkt::Timestamp>,

    /// Output only. Server-defined resource path for the target of the operation.
    pub target: std::string::String,

    /// Output only. Name of the verb executed by the operation.
    pub status_message: std::string::String,

    /// Output only. Identifies whether the user has requested cancellation
    /// of the operation. Operations that have successfully been cancelled
    /// have
    /// [google.longrunning.Operation.error][google.longrunning.Operation.error]
    /// value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
    /// corresponding to `Code.CANCELLED`.
    ///
    /// [google.longrunning.Operation.error]: longrunning::model::Operation::result
    /// [google.rpc.Status.code]: rpc::model::Status::code
    pub requested_cancellation: bool,

    /// Output only. API version used to start the operation.
    pub api_version: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportDataMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [operation_metadata][crate::model::ImportDataMetadata::operation_metadata].
    pub fn set_operation_metadata<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferOperationMetadata>,
    {
        self.operation_metadata = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [operation_metadata][crate::model::ImportDataMetadata::operation_metadata].
    pub fn set_or_clear_operation_metadata<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferOperationMetadata>,
    {
        self.operation_metadata = v.map(|x| x.into());
        self
    }

    /// Sets the value of [create_time][crate::model::ImportDataMetadata::create_time].
    pub fn set_create_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [create_time][crate::model::ImportDataMetadata::create_time].
    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.create_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [end_time][crate::model::ImportDataMetadata::end_time].
    pub fn set_end_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [end_time][crate::model::ImportDataMetadata::end_time].
    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.end_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [target][crate::model::ImportDataMetadata::target].
    pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.target = v.into();
        self
    }

    /// Sets the value of [status_message][crate::model::ImportDataMetadata::status_message].
    pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.status_message = v.into();
        self
    }

    /// Sets the value of [requested_cancellation][crate::model::ImportDataMetadata::requested_cancellation].
    pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.requested_cancellation = v.into();
        self
    }

    /// Sets the value of [api_version][crate::model::ImportDataMetadata::api_version].
    pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.api_version = v.into();
        self
    }
}

impl wkt::message::Message for ImportDataMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ImportDataMetadata"
    }
}

/// Specifies a Cloud Storage bucket and, optionally, a path inside the bucket.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsPath {
    /// Required. The URI to a Cloud Storage bucket, or a path within a bucket,
    /// using the format `gs://<bucket_name>/<optional_path_inside_bucket>/`. If a
    /// path inside the bucket is specified, it must end with a forward slash
    /// (`/`).
    pub uri: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GcsPath {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [uri][crate::model::GcsPath::uri].
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uri = v.into();
        self
    }
}

impl wkt::message::Message for GcsPath {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.GcsPath"
    }
}

/// The root directory path to the Lustre file system.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LustrePath {
    /// Optional. The root directory path to the Managed Lustre file system. Must
    /// start with
    /// `/`. Default is `/`. If you're importing data into Managed Lustre, any
    /// path other than the default must already exist on the file system.
    pub path: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LustrePath {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [path][crate::model::LustrePath::path].
    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.path = v.into();
        self
    }
}

impl wkt::message::Message for LustrePath {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.LustrePath"
    }
}

/// A collection of counters that report the progress of a transfer operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferCounters {
    /// Objects found in the data source that are scheduled to be transferred,
    /// excluding any that are filtered based on object conditions or skipped due
    /// to sync.
    pub found_objects_count: i64,

    /// Total number of bytes found in the data source that are scheduled to be
    /// transferred, excluding any that are filtered based on object conditions or
    /// skipped due to sync.
    pub bytes_found_count: i64,

    /// Objects in the data source that are not transferred because they already
    /// exist in the data destination.
    pub objects_skipped_count: i64,

    /// Bytes in the data source that are not transferred because they already
    /// exist in the data destination.
    pub bytes_skipped_count: i64,

    /// Objects that are copied to the data destination.
    pub objects_copied_count: i64,

    /// Bytes that are copied to the data destination.
    pub bytes_copied_count: i64,

    /// Output only. Objects that are failed to write to the data destination.
    pub objects_failed_count: i64,

    /// Output only. Bytes that are failed to write to the data destination.
    pub bytes_failed_count: i64,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferCounters {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [found_objects_count][crate::model::TransferCounters::found_objects_count].
    pub fn set_found_objects_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.found_objects_count = v.into();
        self
    }

    /// Sets the value of [bytes_found_count][crate::model::TransferCounters::bytes_found_count].
    pub fn set_bytes_found_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.bytes_found_count = v.into();
        self
    }

    /// Sets the value of [objects_skipped_count][crate::model::TransferCounters::objects_skipped_count].
    pub fn set_objects_skipped_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.objects_skipped_count = v.into();
        self
    }

    /// Sets the value of [bytes_skipped_count][crate::model::TransferCounters::bytes_skipped_count].
    pub fn set_bytes_skipped_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.bytes_skipped_count = v.into();
        self
    }

    /// Sets the value of [objects_copied_count][crate::model::TransferCounters::objects_copied_count].
    pub fn set_objects_copied_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.objects_copied_count = v.into();
        self
    }

    /// Sets the value of [bytes_copied_count][crate::model::TransferCounters::bytes_copied_count].
    pub fn set_bytes_copied_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.bytes_copied_count = v.into();
        self
    }

    /// Sets the value of [objects_failed_count][crate::model::TransferCounters::objects_failed_count].
    pub fn set_objects_failed_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.objects_failed_count = v.into();
        self
    }

    /// Sets the value of [bytes_failed_count][crate::model::TransferCounters::bytes_failed_count].
    pub fn set_bytes_failed_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.bytes_failed_count = v.into();
        self
    }
}

impl wkt::message::Message for TransferCounters {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.TransferCounters"
    }
}

/// An entry describing an error that has occurred.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ErrorLogEntry {
    /// Required. A URL that refers to the target (a data source, a data sink,
    /// or an object) with which the error is associated.
    pub uri: std::string::String,

    /// A list of messages that carry the error details.
    pub error_details: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ErrorLogEntry {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [uri][crate::model::ErrorLogEntry::uri].
    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.uri = v.into();
        self
    }

    /// Sets the value of [error_details][crate::model::ErrorLogEntry::error_details].
    pub fn set_error_details<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.error_details = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ErrorLogEntry {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ErrorLogEntry"
    }
}

/// A summary of errors by error code, plus a count and sample error log
/// entries.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ErrorSummary {
    /// Required.
    pub error_code: rpc::model::Code,

    /// Required. Count of this type of error.
    pub error_count: i64,

    /// Error samples.
    ///
    /// At most 5 error log entries are recorded for a given
    /// error code for a single transfer operation.
    pub error_log_entries: std::vec::Vec<crate::model::ErrorLogEntry>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ErrorSummary {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [error_code][crate::model::ErrorSummary::error_code].
    pub fn set_error_code<T: std::convert::Into<rpc::model::Code>>(mut self, v: T) -> Self {
        self.error_code = v.into();
        self
    }

    /// Sets the value of [error_count][crate::model::ErrorSummary::error_count].
    pub fn set_error_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
        self.error_count = v.into();
        self
    }

    /// Sets the value of [error_log_entries][crate::model::ErrorSummary::error_log_entries].
    pub fn set_error_log_entries<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ErrorLogEntry>,
    {
        use std::iter::Iterator;
        self.error_log_entries = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ErrorSummary {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.ErrorSummary"
    }
}

/// Represents the metadata of the long-running transfer operation.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TransferOperationMetadata {
    /// Output only. The progress of the transfer operation.
    pub counters: std::option::Option<crate::model::TransferCounters>,

    /// Output only. The type of transfer occurring.
    pub transfer_type: crate::model::TransferType,

    /// Output only. Error summary about the transfer operation
    pub error_summaries: std::vec::Vec<crate::model::ErrorSummary>,

    /// The source of transfer operation.
    pub source: std::option::Option<crate::model::transfer_operation_metadata::Source>,

    /// The destination of transfer operation.
    pub destination: std::option::Option<crate::model::transfer_operation_metadata::Destination>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl TransferOperationMetadata {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [counters][crate::model::TransferOperationMetadata::counters].
    pub fn set_counters<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::TransferCounters>,
    {
        self.counters = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [counters][crate::model::TransferOperationMetadata::counters].
    pub fn set_or_clear_counters<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::TransferCounters>,
    {
        self.counters = v.map(|x| x.into());
        self
    }

    /// Sets the value of [transfer_type][crate::model::TransferOperationMetadata::transfer_type].
    pub fn set_transfer_type<T: std::convert::Into<crate::model::TransferType>>(
        mut self,
        v: T,
    ) -> Self {
        self.transfer_type = v.into();
        self
    }

    /// Sets the value of [error_summaries][crate::model::TransferOperationMetadata::error_summaries].
    pub fn set_error_summaries<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ErrorSummary>,
    {
        use std::iter::Iterator;
        self.error_summaries = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [source][crate::model::TransferOperationMetadata::source].
    ///
    /// Note that all the setters affecting `source` are mutually
    /// exclusive.
    pub fn set_source<
        T: std::convert::Into<std::option::Option<crate::model::transfer_operation_metadata::Source>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = v.into();
        self
    }

    /// The value of [source][crate::model::TransferOperationMetadata::source]
    /// if it holds a `SourceLustrePath`, `None` if the field is not set or
    /// holds a different branch.
    pub fn source_lustre_path(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::LustrePath>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::transfer_operation_metadata::Source::SourceLustrePath(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::TransferOperationMetadata::source]
    /// to hold a `SourceLustrePath`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_source_lustre_path<
        T: std::convert::Into<std::boxed::Box<crate::model::LustrePath>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::transfer_operation_metadata::Source::SourceLustrePath(v.into()),
        );
        self
    }

    /// The value of [source][crate::model::TransferOperationMetadata::source]
    /// if it holds a `SourceGcsPath`, `None` if the field is not set or
    /// holds a different branch.
    pub fn source_gcs_path(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPath>> {
        #[allow(unreachable_patterns)]
        self.source.as_ref().and_then(|v| match v {
            crate::model::transfer_operation_metadata::Source::SourceGcsPath(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [source][crate::model::TransferOperationMetadata::source]
    /// to hold a `SourceGcsPath`.
    ///
    /// Note that all the setters affecting `source` are
    /// mutually exclusive.
    pub fn set_source_gcs_path<T: std::convert::Into<std::boxed::Box<crate::model::GcsPath>>>(
        mut self,
        v: T,
    ) -> Self {
        self.source = std::option::Option::Some(
            crate::model::transfer_operation_metadata::Source::SourceGcsPath(v.into()),
        );
        self
    }

    /// Sets the value of [destination][crate::model::TransferOperationMetadata::destination].
    ///
    /// Note that all the setters affecting `destination` are mutually
    /// exclusive.
    pub fn set_destination<
        T: std::convert::Into<
                std::option::Option<crate::model::transfer_operation_metadata::Destination>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = v.into();
        self
    }

    /// The value of [destination][crate::model::TransferOperationMetadata::destination]
    /// if it holds a `DestinationGcsPath`, `None` if the field is not set or
    /// holds a different branch.
    pub fn destination_gcs_path(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsPath>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::transfer_operation_metadata::Destination::DestinationGcsPath(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::TransferOperationMetadata::destination]
    /// to hold a `DestinationGcsPath`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_destination_gcs_path<
        T: std::convert::Into<std::boxed::Box<crate::model::GcsPath>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::transfer_operation_metadata::Destination::DestinationGcsPath(v.into()),
        );
        self
    }

    /// The value of [destination][crate::model::TransferOperationMetadata::destination]
    /// if it holds a `DestinationLustrePath`, `None` if the field is not set or
    /// holds a different branch.
    pub fn destination_lustre_path(
        &self,
    ) -> std::option::Option<&std::boxed::Box<crate::model::LustrePath>> {
        #[allow(unreachable_patterns)]
        self.destination.as_ref().and_then(|v| match v {
            crate::model::transfer_operation_metadata::Destination::DestinationLustrePath(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [destination][crate::model::TransferOperationMetadata::destination]
    /// to hold a `DestinationLustrePath`.
    ///
    /// Note that all the setters affecting `destination` are
    /// mutually exclusive.
    pub fn set_destination_lustre_path<
        T: std::convert::Into<std::boxed::Box<crate::model::LustrePath>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.destination = std::option::Option::Some(
            crate::model::transfer_operation_metadata::Destination::DestinationLustrePath(v.into()),
        );
        self
    }
}

impl wkt::message::Message for TransferOperationMetadata {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.lustre.v1.TransferOperationMetadata"
    }
}

/// Defines additional types related to [TransferOperationMetadata].
pub mod transfer_operation_metadata {
    #[allow(unused_imports)]
    use super::*;

    /// The source of transfer operation.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Source {
        /// Output only. Lustre source.
        SourceLustrePath(std::boxed::Box<crate::model::LustrePath>),
        /// Output only. Cloud Storage source.
        SourceGcsPath(std::boxed::Box<crate::model::GcsPath>),
    }

    /// The destination of transfer operation.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Destination {
        /// Output only. Cloud Storage destination.
        DestinationGcsPath(std::boxed::Box<crate::model::GcsPath>),
        /// Output only. Lustre destination.
        DestinationLustrePath(std::boxed::Box<crate::model::LustrePath>),
    }
}

/// Type of transfer that occurred.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TransferType {
    /// Zero is an illegal value.
    Unspecified,
    /// Imports to Lustre.
    Import,
    /// Exports from Lustre.
    Export,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [TransferType::value] or
    /// [TransferType::name].
    UnknownValue(transfer_type::UnknownValue),
}

#[doc(hidden)]
pub mod transfer_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl TransferType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::Import => std::option::Option::Some(1),
            Self::Export => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("TRANSFER_TYPE_UNSPECIFIED"),
            Self::Import => std::option::Option::Some("IMPORT"),
            Self::Export => std::option::Option::Some("EXPORT"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for TransferType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for TransferType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for TransferType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::Import,
            2 => Self::Export,
            _ => Self::UnknownValue(transfer_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for TransferType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "TRANSFER_TYPE_UNSPECIFIED" => Self::Unspecified,
            "IMPORT" => Self::Import,
            "EXPORT" => Self::Export,
            _ => Self::UnknownValue(transfer_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for TransferType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::Import => serializer.serialize_i32(1),
            Self::Export => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for TransferType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<TransferType>::new(
            ".google.cloud.lustre.v1.TransferType",
        ))
    }
}
